<?php
class Zendvn_Validate_Captcha extends Zend_Validate_Abstract{

	const NOT_EQUAL     = 'captchaNotEqual';
	
	protected $_messageTemplates = array(
        	self::NOT_EQUAL      => "Dãy số bảo mật không đúng",
		);
	
	//$pass = '123456';
	//$confirm = '123213123';
	
	protected  $_captcha_id;
	
	public function __construct($captcha_id){
		$this->_captcha_id = $captcha_id;
	}
	
	public function isValid($value){
	    $ssCaptcha = 'Zend_From_Captcha_' . $this->_captcha_id;
		$ss = new Zend_Session_Namespace($ssCaptcha);
		$word =  $ss->word ;
		if(strcmp($value,$word) != 0){
			$this->_error('captchaNotEqual');
			return false;
		}
		return true;
	}
}